package com.lora.judge.type;

import com.lora.judge.CheckModel;

import java.math.BigDecimal;

/**
 * 小于比较
 * target < source 返回 false 表示到达预警值，验证失败
 */
public class LtCheck extends CheckModel {

    private static LtCheck check;
    private LtCheck() {}
    public static LtCheck getInstance() {
        if(check == null) {
            check = new LtCheck();
        }
        return check;
    }

    @Override
    public boolean checkDate() {
        return true;
    }

    @Override
    public boolean checkDateTime() {
        return true;
    }

    @Override
    public boolean checkInt() {
        return true;
    }

    @Override
    public boolean checkLong() {
        return true;
    }

    @Override
    public boolean checkBigDecimal() {
        BigDecimal source = (BigDecimal) this.source;
        BigDecimal target = (BigDecimal) this.target;
        if(target.doubleValue() < source.doubleValue()) {
            return false;
        } else {
            return true;
        }
    }

    @Override
    public boolean checkString() {
        return true;
    }

}
